package cn.tedu.encoding;


import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
/*
* 常用编码是utf-8与gbk ,出现乱码情况 一定是编写时与查看时编码不一致*/
public class TestEncode {
    public static void main(String[] args) {
        OutputStreamWriter out=null;
        String a=   "System.out.println(\"山东菏泽曹县牛皮666我累宝贝\")";

        try {
            out=new OutputStreamWriter(new FileOutputStream("G:\\IO\\1.txt",true),"gbk");//utf-8
            for (int i = 0; i < 10000; i++) {

               // out.write("今天心情好\n");
                out.write(a+"\n");
            }
            System.out.println("Successful");
        }catch (Exception e){
            System.out.println("Default");
        }finally {
            if (out!=null){
                try {
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
